package com.zhuzhe.blog.category.feign;




import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhuzhe.blog.category.entity.Label;
import com.zhuzhe.blog.category.responseVo.LabellistVo;
import com.zhuzhe.blog.category.service.ILabelService;
import com.zhuzhe.blog.convert.Convert;
import com.zhuzhe.blog.feign.label.IFeignLabelController;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;

@Api(value = "被远程调用的文章微服务接口", description = "被远程调用的文章微服务接口")
@RestController
public class FeignLabelController implements IFeignLabelController {

    @Autowired
    private ILabelService labelService;

    @Override
    public List<LabellistVo> getLabelListByIds(List<String> labelIds) {
        // IService<Label>中已经实现了此批量查询标签信息功能，mybatis-plus已经提供的
        List<Label> labels = labelService.getLabelListByIds(labelIds);
        List<LabellistVo> labellistVos = Convert.convertList(labels,LabellistVo.class);
        return labellistVos;
    }

    /**
     *
     * 根据分类id 获取标签id集合
     * @param categoryId
     * @return
     */
    @Override
    public List<String> getLabelListByIds(String categoryId) {
        return labelService.getListIds(categoryId);
    }

}
